<?php
class userController extends Controller {
    function register() {
        $username = $_POST['user_name'];
        $userpwd = $_POST['user_pwd'];
        $Email = $_POST['user_email'];
        $dbobj = M();
        $result = $dbobj->insert('user',array(
                'username'=>$username,
                'userpwd'=>$userpwd,
                'email'=>$Email)
        );
        if($result){
            print_r('注册成功:'.$result);
        }else{
            print_r('注册失败:'.$result);
        }
    }
    function user_register(){
        $this->display();
    }
    function user_login(){
        $this->display();
    }
    function submit(){
        $username = $_POST['username'];
        $userpwd = $_POST['userpwd'];
        $dbobj = M();
        $result = $dbobj->select('user','*',array("AND"=>array("username"=>$username,"userpwd"=>$userpwd)));
        foreach($result as $value){
            $_SESSION["username"] = $value['username'];
            $_SESSION["userpwd"] = $value['userpwd'];
        }
        print_r($_SESSION);
//        $_SESSION[]
    }
}